# libdv
# Builds from https://github.com/puppylinux-woof-CE/petbuilds

. ../func
. ../build.conf
http://downloads.sourceforge.net/project/libdv/libdv/1.0.0/
URL=http://downloads.sourceforge.net/project/libdv/libdv/1.0.0/
PKG=libdv
VER=1.0.0
COMP=tar.gz
DESC="software codec for DV video"
DEPS=+popt,+v4l-utils
CAT=BuildingBlock
DESKTOP=libdv.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)	
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not	

ARCH=$(uname -m)
case $ARCH in
 *64) 	LIBDIR=$LIBCONF64; FLAGS="CFLAGS=-fPIC" ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

patch_me() {
	for i in *patch; do
		echo "applying $i"
		patch -p0 < $i
	done
}

build() {
	cd ${PKG}-${VER}
	./configure --prefix=/usr \
				--localstatedir=/var \
				--sysconfdir=/etc \
				--libdir=/usr/${LIBDIR} \
				--enable-sdl \
				--disable-static \
				$FLAGS
	[ "$?" -eq 0 ] || exit
	make $MKFLG
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install
	cd -
}
	
# main
retrieve ${PKG}-${VER}.${COMP}
extract ${PKG}-${VER}.${COMP}
patch_me
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
